package com.liuzh.kaoyanspringboot.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liuzh.kaoyanspringboot.entity.Article;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 刘志鸿
 * @since 2023-03-10
 */
@Mapper
public interface ArticleMapper extends BaseMapper<Article> {

    Page<Article> findPage(Page<Article> page,@Param("name") String name, @Param("userId") Integer userId);
    Page<Article> findCollectPage(Page<Article> page,@Param("collectId") Integer collectId,@Param("articleName") String articleName);

    Article findById(@Param("id") Integer id);

    Article miniFindById(@Param("id") Integer id);

    List<Article> findAll(@Param("userId") Integer userId);

    boolean decrementLike(@Param("id") Integer id);

    boolean increaseLike(@Param("id") Integer id);

    boolean reNewById(Article article);

    boolean decrementCollect(@Param("id") Integer id);

    boolean increaseCollect(@Param("id") Integer id);

    Integer myCount();

    List<Article> selectListDate();

    List<Article> selectSlideshow();
}
